import request from '@/utils/request';
import { IFlwProcessVO, IFlwProcessDTO, IFlwProcessQuery } from '.';

export function fetchList(query?: IPaginationQuery & IFlwProcessQuery): IPaginationResWrapper<IFlwProcessVO> {
	return request({
		url: '/oa/process/page',
		method: 'get',
		params: query,
	});
}

export function getObj(id?: string): IResWrapper<IFlwProcessVO> {
	return request({
		url: '/oa/process/' + id,
		method: 'get',
	});
}

export function putObj(obj?: IFlwProcessDTO): IResWrapper<IFlwProcessVO> {
	return request({
		url: '/oa/process',
		method: 'post',
		data: obj,
	});
}

export function queryPrecessDetail(obj?: IFlwProcessDTO): IResWrapper<IFlwProcessVO> {
	return request({
		url: '/oa/process',
		method: 'post',
		data: obj,
	});
}

export function getProcessByKey(key: string): IResWrapper<IFlwProcessVO> {
	return request({
		url: '/oa/process/getProcessByKey',
		method: 'post',
		params: {
			processKey: key,
		},
	});
}

export function queryAllProcessList(): IResWrapper<IFlwProcessVO[]> {
	return request({
		url: '/oa/process/queryAllProcessList',
		method: 'get',
	});
}
